import { authApi } from './auth/authApi'
import { tokenManager } from './auth/tokenManager'
import { userManager } from './auth/userManager'
import { tokenRefreshManager } from './auth/tokenRefreshManager'
import api from './axios'

// 导出统一的API服务
export const userApi = {
  // 用户相关API
  login: authApi.login,
  logout: authApi.logout,
  getUserInfo: () => api.get('/auth/user/'),
  register: (data) => api.post('/auth/register/', data),
  
  // Token管理
  refreshToken: authApi.refreshToken,
  startTokenRefresh: tokenRefreshManager.start,
  stopTokenRefresh: tokenRefreshManager.stop,
  
  // 状态检查
  isLoggedIn: tokenManager.isLoggedIn,
  getCurrentUser: userManager.getUserInfo
}

// 导出其他模块的API
export * from './student'
export * from './course'
export * from './role'

// 导出基础API实例
export { api } 